<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * 文档管理
 */
class Word extends MY_Controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('word_mdl');
    }
	
	public function index(){
		//分页
        $url = '';
        // $this->db->start_cache();
		 // $this->db->stop_cache();

        $this->load->library('pagination');
        $this->config->load('page', TRUE);
        $config = $this->config->config;
        $config = $config['page'];
        $config['base_url'] = site_url('user/index').$url;
        $config['total_rows'] = $this->word_mdl->get_count();

        $this->pagination->initialize($config);
        $data['page'] = $this->pagination->create_links();

        $per_page = $this->input->get('per_page');
        $this->db->limit($config['per_page'],intval($per_page));
		$this->db->select('id,title,create_time,user_id,update_time');
        $this->db->order_by('id desc');
        $list = $this->word_mdl->select();
        $data['rows'] = $config['total_rows'];
        //echo $this->db->last_query();
        // $this->db->flush_cache();

        $data['list'] = $list;
        $this->_view('index',$data);
	}
	
	/**
	 * 文档新增
	 */
	public function create(){
		if($this->input->is_ajax_request()){
			
		}else{
			$this->_view('create');
		}
	}
}